import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

public class MyGrpcClient {
    public static void main(String[] args) throws InterruptedException {

        ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8082)
                .usePlaintext()
                .build();

        com.example.grpc.HelloServiceGrpc.HelloServiceBlockingStub stub =
                com.example.grpc.HelloServiceGrpc.newBlockingStub(channel);

        com.example.grpc.HelloResponse helloResponse = stub.hello(
                com.example.grpc.HelloRequest.newBuilder()
                        .setName("刚子")
                        .setAge(17)
                        .addHobbies("追龙").putTags("性格", "阳光小子")
                        .build());

        System.out.println(helloResponse.getGreeting());


        channel.shutdown();
    }
}